from django.db import models
from django.utils.timezone import now


class ProductOrderModel(models.Model):
    id = models.CharField(db_column="c_id", max_length=32, verbose_name=u"主键", primary_key=True, blank=False,
                          null=False)
    order_key = models.CharField(db_column="c_order_key", max_length=32, verbose_name=u"订单id", blank=False, null=False)
    order_id = models.CharField(db_column="c_order_id", max_length=100, verbose_name="品名", blank=False,
                                null=False)
    product_key = models.CharField(db_column="c_product_key", max_length=32, verbose_name=u"产品id", blank=False,
                                   null=False)
    product_name = models.CharField(db_column="c_product_name", max_length=100, verbose_name="品名", blank=False,
                                    null=False)
    product_number = models.CharField(db_column="c_product_number", max_length=100, verbose_name="品号", blank=False,
                                      null=False)
    product_sum = models.IntegerField(db_column="c_sum", verbose_name="数量", default=0)
    is_delete = models.BooleanField(db_column="c_is_delete", default=False)
    create_date = models.DateTimeField(db_column="c_create_date", default=now)
    update_date = models.DateTimeField(db_column="c_update_date", default=now)

    class Meta:
        db_table = "t_product_order"
        verbose_name = "订单产品中间表"
        verbose_name_plural = verbose_name
        ordering = ["-create_date"]
